home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / perfex.z / perfex
Text File  |  1998-10-20  |  22KB  |  463 lines

  1.  
  2.  
  3.  
  4. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ppppeeeerrrrffffeeeexxxx - a command line interface to R10000 counters
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      perfex [----aaaa | ----eeee eeeevvvveeeennnntttt0000 [----eeee eeeevvvveeeennnntttt1111]] [----mmmmpppp | ----ssss]
  13.      [----xxxx] [----yyyy] [----tttt][----oooo <<<<ffffiiiilllleeee>>>>] [----cccc <<<<ffffiiiilllleeee>>>>] [----llll <<<<nnnnnnnn>>>>] _c_o_m_m_a_n_d
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The given _c_o_m_m_a_n_d is executed; after it is complete, _p_e_r_f_e_x prints the
  18.      values of various hardware performance counters.  The counts returned are
  19.      aggregated over all processes which are descendants of the target
  20.      command, as long as their parent process controls the child through wwwwaaaaiiiitttt
  21.      (see wait(2)).
  22.  
  23.      The integers _e_v_e_n_t_0 and _e_v_e_n_t_1 index this table:
  24.           0 = Cycles
  25.           1 = Issued instructions
  26.           2 = Issued loads
  27.           3 = Issued stores
  28.           4 = Issued store conditionals
  29.           5 = Failed store conditionals
  30.           6 = Decoded branches
  31.           7 = Quadwords written back from scache
  32.           8 = Correctable scache data array ECC errors
  33.           9 = Primary instruction cache misses
  34.           10 = Secondary instruction cache misses
  35.           11 = Instruction misprediction from scache way prediction table
  36.           12 = External interventions
  37.           13 = External invalidations
  38.           14 = Virtual coherency conditions
  39.           15 = Graduated instructions
  40.           16 = Cycles
  41.           17 = Graduated instructions
  42.           18 = Graduated loads
  43.           19 = Graduated stores
  44.           20 = Graduated store conditionals
  45.           21 = Graduated floating point instructions
  46.           22 = Quadwords written back from primary data cache
  47.           23 = TLB misses
  48.           24 = Mispredicted branches
  49.           25 = Primary data cache misses
  50.           26 = Secondary data cache misses
  51.           27 = Data misprediction from scache way prediction table
  52.           28 = External intervention hits in scache
  53.           29 = External invalidation hits in scache
  54.           30 = Store/prefetch exclusive to clean block in scache
  55.           31 = Store/prefetch exclusive to shared block in scache
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  71.  
  72.  
  73.  
  74. BBBBAAAASSSSIIIICCCC OOOOPPPPTTTTIIIIOOOONNNNSSSS
  75.      ----eeee eeeevvvveeeennnntttt
  76.           Specify an event to be counted.
  77.  
  78.           2, 1, or 0 event specifiers may be given, the default events being
  79.           to count cycles.  Events may also be specified by setting one or
  80.           both of the environment variables TTTT5555____EEEEVVVVEEEENNNNTTTT0000 and TTTT5555____EEEEVVVVEEEENNNNTTTT1111. Command
  81.           line event specifiers if present will override these. The order of
  82.           events specified is not important.  The counts, together with an
  83.           event description are written to _s_t_d_e_r_r, unless redirected with the
  84.           ----oooo option. Two events which mmmmuuuusssstttt be counted on the same hardware
  85.           counter (see rrrr11110000kkkk____ccccoooouuuunnnntttteeeerrrrssss(5)) will cause a conflicting counters
  86.           error.
  87.  
  88.      ----aaaa   Multiplex over all events, projecting totals.  Ignore event
  89.           specifiers.
  90.  
  91.           The option ----aaaa produces counts for all events by multiplexing over 16
  92.           events per counter. The OS does the switching round robin at clock
  93.           interrupt boundaries. The resulting counts are normalized by
  94.           multiplying by 16 to give an estimate of the values they would have
  95.           had for exclusive counting. Due to the equal-time nature of the
  96.           multiplexing, it is true with high probability that any events
  97.           present in large enough numbers to contribute significantly to the
  98.           execution time will be fairly represented. Events concentrated in a
  99.           few short regions (say, icache misses) may not be projected very
  100.           accurately.
  101.  
  102.      ----mmmmpppp  Report per-thread counts for mp programs as well as (default)
  103.           totals.
  104.  
  105.           By default perfex aggregates the counts of all the child threads and
  106.           reports this number for each selected event. The ----mmmmpppp option causes
  107.           the counters for each thread to be collected at thread exit time and
  108.           printed out, followed by the counts aggregated across all threads.
  109.           The per-thread counts are labeled by pid.
  110.  
  111.      ----oooo <<<<ffffiiiilllleeee>>>>
  112.           Redirect perfex output to the specified file.
  113.  
  114.      ----ssss   Start(stop) counting on SSSSIIIIGGGGUUUUSSSSRRRR1111(SSSSIIIIGGGGUUUUSSSSRRRR2222) signal receipt by _p_e_r_f_e_x
  115.           process.
  116.  
  117.           This option causes perfex to wait until it (i.e. the perfex process)
  118.           receives a SSSSIIIIGGGGUUUUSSSSRRRR1111, before it starts counting (for the child
  119.           process, the target). It will stop counting if it receives a
  120.           SSSSIIIIGGGGUUUUSSSSRRRR2222. Repeated cycles of this will aggregate counts. If no
  121.           SSSSIIIIGGGGUUUUSSSSRRRR2222 is received, the counting will continue until the child
  122.           exits (a normal case).  Note that counting for descendants of the
  123.           child will not be affected.  Thus counting for mp programs cannot be
  124.           controlled with this option.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  137.  
  138.  
  139.  
  140.      ----xxxx   Count at exception level (as well as the default user level).
  141.  
  142.           Exception level includes time spent on behalf of the user during,
  143.           e.g., TLB refill exceptions.  Other counting modes (kernel,
  144.           supervisor) are available through the OS ioctl interface ( see
  145.           rrrr11110000kkkk____ccccoooouuuunnnntttteeeerrrrssss(5) ).
  146.  
  147.      To collect instruction and data scache miss counts on a program normally
  148.      executed by
  149.         % bar < bar.in > bar.out
  150.       would be accomplished by
  151.         % perfex -e 26 -e 10 bar < bar.in > bar.out .
  152.  
  153.  
  154. CCCCOOOOSSSSTTTT EEEESSSSTTTTIIIIMMMMAAAATTTTEEEE OOOOPPPPTTTTIIIIOOOONNNNSSSS
  155.      ----yyyy   Report statistics and ranges of estimated times per event.
  156.  
  157.           Without the -y option, perfex reports the counts recorded by the
  158.           R10000 event counters for the events requested. As these are simply
  159.           raw counts, it is difficult to know by inspection which events are
  160.           responsible for significant portions of the job's run time. The -y
  161.           option associates an approximate time cost with some of the event
  162.           counts.
  163.  
  164.           The reported times are approximate.  Due to the superscalar nature
  165.           of the R10000, and its ability to hide latency, one cannot state a
  166.           precise cost for a single occurrence of many of the events. Cache
  167.           misses, for example, can be overlapped with other operations, so
  168.           there is a wide range of times possible for any cache miss.
  169.  
  170.           To account for the fact that the cost of many events cannot be known
  171.           precisely, perfex -y reports a range of time costs for each event.
  172.           """"MMMMaaaaxxxxiiiimmmmuuuummmm,,,,"""" """"mmmmiiiinnnniiiimmmmuuuummmm,,,,"""" and """"ttttyyyyppppiiiiccccaaaallll"""" time costs are reported. Each is
  173.           obtained by consulting an internal table which holds the "maximum,"
  174.           "minimum," and "typical" costs for each event, and multiplying this
  175.           cost by the count for the event. Event costs are usually measured in
  176.           terms of machine cycles, and so the cost of an event generally
  177.           depends on the clock speed of the processor, which is also reported
  178.           in the output.
  179.  
  180.           The "maximum" value contained in the table corresponds to the worst
  181.           case cost of a single occurrence of the event. Sometimes this can be
  182.           a very pessimistic estimate. For example, the maximum cost for
  183.           graduated floating point instructions assumes that all such
  184.           instructions are double precision reciprocal square roots, since
  185.           that is the most costly R10000 floating point instruction.
  186.  
  187.           Due to the latency-hiding capabilities of the R10000, the "minimum"
  188.           cost of virtually any event could be zero since most events can be
  189.           overlapped with other operations. To avoid simply reporting minimum
  190.           costs of 0, which would be of no practical use, the "minimum" time
  191.           reported by perfex -y corresponds to the best case cost of a single
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  203.  
  204.  
  205.  
  206.           occurrence of the event. The "best case" cost is obtained by running
  207.           the maximum number of simultaneous occurrences of that event and
  208.           averaging the cost. For example, two floating point instructions can
  209.           complete per cycle, so the best case cost is 0.5 cycles per floating
  210.           point instruction.
  211.  
  212.           The "typical" cost falls somewhere between "minimum" and maximum"
  213.           and is meant to correspond to the cost one would expect to see in
  214.           average programs. For example, to measure the "typical" cost of a
  215.           cache miss, stride-1 accesses to an array too big to fit in cache
  216.           were timed and the number of cache misses generated was counted. The
  217.           same number of stride-1 accesses to an in-cache array were then
  218.           timed. The difference in times corresponds to the cost of the cache
  219.           misses, and this was used to calculate the average cost of a cache
  220.           miss. This "typical" cost is lower than the worst case in which each
  221.           cache miss cannot be overlapped, and it is higher than the best case
  222.           in which several independent, and hence, overlapping, cache misses
  223.           are generated.  (Note that on Origin systems, this methodology
  224.           yields the time for L2 cache misses to local memory only.)
  225.           Naturally, these "typical" costs are somewhat arbitrary.  If they do
  226.           not seem right for the application being measuring with perfex, they
  227.           can be replaced by user-supplied values. See the -c option below.
  228.  
  229.           perfex -y prints the event counts and associated cost estimates
  230.           sorted from most costly to least costly. While resembling a
  231.           profiling output, this is not a true profile. The event costs
  232.           reported are only estimates. Furthermore, since events do overlap
  233.           with each other, the sum of the estimated times will usually exceed
  234.           the program's run time.  This output should only be used to identify
  235.           which events are responsible for significant portions of the
  236.           program's run time, and to get a rough idea of what those costs
  237.           might be.
  238.  
  239.           With this in mind, the built-in cost table does not make an attempt
  240.           to provide detailed costs for all events. Some events provide
  241.           summary or redundant information. These events are assigned
  242.           "minimum" and "typical" costs of 0 so that they sort to the bottom
  243.           of the output.  The "maximum" costs are set to 1 cycle so that one
  244.           can get an indication of the time corresponding to these events.
  245.           "Issued instructions" and "graduated instructions" are examples of
  246.           such events.  In addition to these summary or redundant events,
  247.           detailed cost information has not been provided for a few other
  248.           events such as "external interventions" and "external invalidations"
  249.           since it is difficult to assign costs to these asynchronous events.
  250.           The built-in cost values may be overridden by user-supplied values
  251.           using the -c option below.
  252.  
  253.           In addition the event counts and cost estimates, perfex -y also
  254.           reports a number of statistics derived from the typical costs. The
  255.           meaning of many of the statistics is self-evident, for example,
  256.           graduated instructions/cycle. Below are listed those statistics
  257.           whose definitions require more explanation:
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  269.  
  270.  
  271.  
  272.      _D_a_t_a _m_i_s_p_r_e_d_i_c_t/_D_a_t_a _s_c_a_c_h_e _h_i_t_s
  273.  
  274.           This is the ratio of the counts for "Data misprediction from scache
  275.           way prediction table" and "Secondary data cache misses."
  276.  
  277.  
  278.      _I_n_s_t_r_u_c_t_i_o_n _m_i_s_p_r_e_d_i_c_t/_I_n_s_t_r_u_c_t_i_o_n _s_c_a_c_h_e _h_i_t_s
  279.  
  280.           This is the ratio of the counts for "Instruction misprediction from
  281.           scache way prediction table" and "Secondary instruction cache
  282.           misses."
  283.  
  284.  
  285.      _L_1 _C_a_c_h_e _L_i_n_e _R_e_u_s_e
  286.  
  287.           The is the number of times, on average, that a primary data cache
  288.           line is used after it has been moved into the cache. It is
  289.           calculated as "graduated loads" plus "graduated stores" minus
  290.           "primary data cache misses," all divided by "primary data cache
  291.           misses."
  292.  
  293.  
  294.      _L_2 _C_a_c_h_e _L_i_n_e _R_e_u_s_e
  295.  
  296.           The is the number of times, on average, that a secondary data cache
  297.           line is used after it has been moved into the cache. It is
  298.           calculated as "primary data cache misses" minus "secondary data
  299.           cache misses," all divided by "secondary data cache misses."
  300.  
  301.      _L_1 _D_a_t_a _C_a_c_h_e _H_i_t _R_a_t_e
  302.  
  303.           This is the fraction of data accesses which are satisfied from a
  304.           cache line already resident in the primary data cache. It is
  305.           calculated as 1.0 - ("primary data cache misses" divided by the sum
  306.           of "graduated loads" and "graduated stores").
  307.  
  308.      _L_2 _D_a_t_a _C_a_c_h_e _H_i_t _R_a_t_e
  309.  
  310.           This is the fraction of data accesses which are satisfied from a
  311.           cache line already resident in the secondary data cache. It is
  312.           calculated as 1.0 - ("secondary data cache misses" divided by
  313.           "primary data cache misses").
  314.  
  315.      _T_i_m_e _a_c_c_e_s_s_i_n_g _m_e_m_o_r_y/_T_o_t_a_l _t_i_m_e
  316.  
  317.           This is the sum of the typical costs of "graduated loads,"
  318.           "graduated stores," "primary data cache misses," "secondary data
  319.           cache misses," and "TLB misses," divided by the total program run
  320.           time. The total program run time is calculated by multiplying
  321.           "cycles" by the time per cycle (inverse of the processor's clock
  322.           speed).
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  335.  
  336.  
  337.  
  338.      _L_1--_L_2 _b_a_n_d_w_i_d_t_h _u_s_e_d (_M_B/_s, _a_v_e_r_a_g_e _p_e_r _p_r_o_c_e_s_s)
  339.  
  340.           This is the amount of data moved between the primary and secondary
  341.           data caches, divided by the total program run time. The anmount of
  342.           data moved is calculated as the sum of the number of "primary data
  343.           cache misses" multiplied by the primary cache line size and the
  344.           number of "quadwords written back from primary data cache"
  345.           multiplied by the size of a quadword (16 bytes).  For multiprocess
  346.           programs, the resulting figure is a per- process average since the
  347.           counts measured by perfex are aggregates of the counts for all the
  348.           threads. One needs to multiply by the number of threads to get the
  349.           total program bandwidth.
  350.  
  351.      _M_e_m_o_r_y _b_a_n_d_w_i_d_t_h _u_s_e_d (_M_B/_s, _a_v_e_r_a_g_e _p_e_r _p_r_o_c_e_s_s)
  352.  
  353.           This is the amount of data moved between the secondary data cache
  354.           and main memory, divided by the total program run time. The anmount
  355.           of data moved is calculated as the sum of the number of "secondary
  356.           data cache misses" multiplied by the secondary cache line size and
  357.           the number of "quadwords written back from secondary data cache"
  358.           multiplied by the size of a quadword (16 bytes).  For multiprocess
  359.           programs, the resulting figure is a per- process average since the
  360.           counts measured by perfex are aggregates of the counts for all the
  361.           threads. One needs to multiply by the number of threads to get the
  362.           total program bandwidth.
  363.  
  364.      _M_F_L_O_P_S (_M_B/_s, _a_v_e_r_a_g_e _p_e_r _p_r_o_c_e_s_s)
  365.  
  366.           This is the ratio of the "graduated floating point instructions" and
  367.           the total program run time. Note that while a multiply-add carries
  368.           out two floating point operations, it only counts as one
  369.           instruction, so this statistic may underestimate the number of
  370.           floating point operations per second. For multiprocess programs, the
  371.           resulting figure is a per-process average since the counts measured
  372.           by perfex are aggregates of the counts for all the threads. One
  373.           needs to multiply by the number of threads to get the total program
  374.           rate.
  375.  
  376.      A ststistic is only printed if counts for the events which define it have
  377.      been gathered.
  378.  
  379.  
  380.      ----cccc <<<<ffffiiiilllleeee>>>>
  381.           Load a cost table from <file> (requires -y).
  382.  
  383.           This option allows one to override the internal event costs used by
  384.           the -y option. <file> contains the list of event costs which are to
  385.           be overridden. This <file> needs to be in the same format as the
  386.           output produced by the -c option. Costs may be specied in units of
  387.           "clks" (machine cycles) or nsec (nanseconds). One may override all
  388.           or only a subset of the default costs.
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. PPPPEEEERRRRFFFFEEEEXXXX((((1111))))                                                            PPPPEEEERRRRFFFFEEEEXXXX((((1111))))
  401.  
  402.  
  403.  
  404.           One may also use the file /etc/perfex.costs to override event costs.
  405.           If this file exists, any costs listed in it will override those
  406.           built into perfex. Costs supplied via the -c option will override
  407.           those provided by the /etc/perfex.costs file.
  408.  
  409.  
  410.      ----tttt   print the cost table used for perfex -y cost estimates to STDOUT
  411.  
  412.           These internal costs may be overridden by specifying different
  413.           values in the file /etc/perfex.costs, or by using the -c <file>
  414.           option. Both <file> and /etc/perfex.costs need to use the format as
  415.           provided by the -t option. It is recommended that one capture this
  416.           output to a file and edit it to create a suitable file for
  417.           /etc/perfex.costs or the -c option. One does not have to specify
  418.           costs for every event, however.  Lines corresponding to events whose
  419.           values one does not wish to override may simply be deleted from the
  420.           file.
  421.  
  422. FFFFIIIILLLLEEEESSSS
  423.      /etc/perfex.costs
  424.  
  425.  
  426. DDDDEEEEPPPPEEEENNNNDDDDEEEENNNNCCCCIIIIEEEESSSS
  427.      ppppeeeerrrrffffeeeexxxx only works on an R10000 system. For the ----mmmmpppp option only, only
  428.      binaries linked -shared are currently supported.  This is due to a
  429.      dependency on _l_i_b_p_e_r_f_e_x._s_o.  The options ----ssss and ----mmmmpppp are currently
  430.      mutually exclusive.
  431.  
  432.  
  433. LLLLIIIIMMMMIIIITTTTAAAATTTTIIIIOOOONNNNSSSS
  434.      The signal control interface (----ssss) can control only the immediate target
  435.      process, not any of its descendants.  This makes it unusable with multi-
  436.      process targets in their parallel regions.
  437.  
  438.  
  439. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  440.      rrrr11110000kkkk____ccccoooouuuunnnntttteeeerrrrssss(5), lllliiiibbbbppppeeeerrrrffffeeeexxxx(3), ttttiiiimmmmeeee(1), ttttiiiimmmmeeeexxxx(1)
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.